<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="../../baselist.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript" src="${ctx }/js/jquery-1.4.4.js"></script>
    <script>
        /* function isOnlyChecked(){
            var checkBoxArray = document.getElementsByName('id');
               var count=0;
               for(var index=0; index<checkBoxArray.length; index++) {
                   if (checkBoxArray[index].checked) {
                       count++;
                   }
               }
           //jquery
           //var count = $("[input name='id']:checked").size();
           if(count==1)
               return true;
           else
               return false;
        }
        function toView(){
            if(isOnlyChecked()){
                formSubmit('deptAction_toview','_self');
            }else{
                alert("请先选择一项并且只能选择一项，再进行操作！");
            }
        }
        //实现更新
        function toUpdate(){
            if(isOnlyChecked()){
                formSubmit('deptAction_toupdate','_self');
            }else{
                alert("请先选择一项并且只能选择一项，再进行操作！");
            }
        } */
    </script>
</head>

<body>
<form name="icform" method="post">
    <input type="hidden" name="id" value="${id }"/>
    <div id="menubar">
        <div id="middleMenubar">
            <div id="innerMenubar">
                <div id="navMenubar">
                    <ul>
                        <li id="update"><a href="#"
                                           onclick="formSubmit('roleAction_allocateDept','_self');this.blur();">保存</a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>

    <div class="textbox" id="centerTextbox">
        <div class="textbox-header">
            <div class="textbox-inner-header">
                <div class="textbox-title">
                    [${role.name }]:管理的部门
                </div>
            </div>
        </div>

        <div>

            <div class="eXtremeTable">
                <table id="ec_table" class="tableRegion" width="98%">
                    <thead>
                    <tr>
                        <td class="tableHeader"><input type="checkbox" name="selid" onclick="checkAll('id',this)"></td>
                        <td class="tableHeader">序号</td>
                        <td class="tableHeader">编号</td>
                        <td class="tableHeader">上级</td>
                        <td class="tableHeader">名称</td>
                    </tr>
                    </thead>
                    <tbody class="tableBody">
                    ${links }

                    <c:forEach items="${results }" var="dept" varStatus="st">
                        <tr class="odd" onmouseover="this.className='highlight'" onmouseout="this.className='odd'">
                            <td><input type="checkbox" name="did" value="${dept.id }"/></td>
                            <td>${st.count }</td>
                            <td>${dept.id }</td>
                            <td>${dept.parent.deptName }</td>
                            <td><a href="deptAction_toview?id=${dept.id }">${dept.deptName }</a></td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>

        </div>


</form>
</body>
</html>

